<!DOCTYPE html>
<html >
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1"><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

      <title>Device types - ArduinoHA</title>
    
          <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
          <link rel="stylesheet" href="../../_static/theme.css " type="text/css" />
          <link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
      
      <!-- sphinx script_files -->
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
        <script src="../../_static/custom.js"></script>

      
      <!-- bundled in js (rollup iife) -->
      <!-- <script src="../../_static/theme-vendors.js"></script> -->
      <script src="../../_static/theme.js" defer></script>
    
  <link rel="index" title="Index" href="../../genindex.html" />
  <link rel="search" title="Search" href="../../search.html" />
  <link rel="next" title="MQTT security" href="mqtt-security.html" />
  <link rel="prev" title="Discovery" href="discovery.html" /> 
  </head>

  <body>
    <div id="app">
    <div class="theme-container" :class="pageClasses"><navbar @toggle-sidebar="toggleSidebar">
  <router-link to="../../index.html" class="home-link">
    
      <span class="site-name">ArduinoHA</span>
    
  </router-link>

  <div class="links">
    <navlinks class="can-hide">



  
    <div class="nav-item">
      <a href="https://github.com/dawidchyrzynski/arduino-home-assistant"
        class="nav-link external">
          Github <outboundlink></outboundlink>
      </a>
    </div>
  

    </navlinks>
  </div>
</navbar>

      
      <div class="sidebar-mask" @click="toggleSidebar(false)">
      </div>
        <sidebar @toggle-sidebar="toggleSidebar">
          
          <navlinks>
            



  
    <div class="nav-item">
      <a href="https://github.com/dawidchyrzynski/arduino-home-assistant"
        class="nav-link external">
          Github <outboundlink></outboundlink>
      </a>
    </div>
  

            
          </navlinks><div id="searchbox" class="searchbox" role="search">
  <div class="caption"><span class="caption-text">Quick search</span>
    <div class="searchformwrapper">
      <form class="search" action="../../search.html" method="get">
        <input type="text" name="q" />
        <input type="submit" value="Search" />
        <input type="hidden" name="check_keywords" value="yes" />
        <input type="hidden" name="area" value="default" />
      </form>
    </div>
  </div>
</div><div class="sidebar-links" role="navigation" aria-label="main navigation">
  <p class="caption" role="heading"><span class="caption-text">Docs</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../getting-started/index.html">Getting started</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../getting-started/prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting-started/installation.html">Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting-started/compatible-hardware.html">Compatible Hardware</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting-started/examples.html">Examples</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Library</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="introduction.html">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="device-configuration.html">Device configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="availability-reporting.html">Availability reporting</a></li>
<li class="toctree-l2"><a class="reference internal" href="connection-params.html">Connection parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="discovery.html">Discovery</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Device types</a></li>
<li class="toctree-l2"><a class="reference internal" href="mqtt-security.html">MQTT security</a></li>
<li class="toctree-l2"><a class="reference internal" href="mqtt-advanced.html">MQTT advanced features</a></li>
<li class="toctree-l2"><a class="reference internal" href="compiler-macros.html">Compiler macros</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../api/index.html">API reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../api/core/index.html">Core API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../api/device-types/index.html">Device types API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../api/utils/index.html">Utils API</a></li>
</ul>
</li>
</ul>

</div>
        </sidebar>

      <page>
          <div class="body-header" role="navigation" aria-label="navigation">
  
  <ul class="breadcrumbs">
    <li><a href="../../index.html">Docs</a> &raquo;</li>
    
      <li><a href="index.html">Library</a> &raquo;</li>
    
    <li>Device types</li>
  </ul>
  

  <ul class="page-nav">
  <li class="prev">
    <a href="discovery.html"
       title="previous chapter">← Discovery</a>
  </li>
  <li class="next">
    <a href="mqtt-security.html"
       title="next chapter">MQTT security →</a>
  </li>
</ul>
  
</div>
<hr>
          <div class="content" role="main" v-pre>
            
  <section id="device-types">
<h1>Device types<a class="headerlink" href="#device-types" title="Permalink to this headline">¶</a></h1>
<p>Device type represents a single entity in the Home Assistant panel.
It can be a sensor, lock, camera or anything that’s listed in the table below.</p>
<p>Your physical device (for example ESP-01 board) can have multiple device types assigned.
They will be displayed as child entities in the HA panel.</p>
<section id="limitations">
<h2>Limitations<a class="headerlink" href="#limitations" title="Permalink to this headline">¶</a></h2>
<p>Registering a new device type requires some flash and RAM memory to be utilized.
On less powerful units like Arduino Uno, you may quickly hit the limit of resources, so keeping the device simple is recommended.
Hitting the resource limit will result in random reboots of the device.</p>
<p>By default, the maximum number of device types is 6.
You can increase the limit using the <a class="reference internal" href="../api/core/ha-mqtt.html"><span class="doc">HAMqtt</span></a> class constructor as follows:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;Ethernet.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;ArduinoHA.h&gt;</span><span class="cp"></span>

<span class="n">byte</span><span class="w"> </span><span class="n">mac</span><span class="p">[]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="mh">0x00</span><span class="p">,</span><span class="w"> </span><span class="mh">0x10</span><span class="p">,</span><span class="w"> </span><span class="mh">0xFA</span><span class="p">,</span><span class="w"> </span><span class="mh">0x6E</span><span class="p">,</span><span class="w"> </span><span class="mh">0x38</span><span class="p">,</span><span class="w"> </span><span class="mh">0x4A</span><span class="p">};</span><span class="w"></span>
<span class="n">EthernetClient</span><span class="w"> </span><span class="n">client</span><span class="p">;</span><span class="w"></span>
<span class="n">HADevice</span><span class="w"> </span><span class="nf">device</span><span class="p">(</span><span class="n">mac</span><span class="p">,</span><span class="w"> </span><span class="k">sizeof</span><span class="p">(</span><span class="n">mac</span><span class="p">));</span><span class="w"></span>
<span class="n">HAMqtt</span><span class="w"> </span><span class="nf">mqtt</span><span class="p">(</span><span class="n">client</span><span class="p">,</span><span class="w"> </span><span class="n">device</span><span class="p">,</span><span class="w"> </span><span class="mi">12</span><span class="p">);</span><span class="w"> </span><span class="c1">// &lt;------------ 12 is a new limit of device types</span>

<span class="kt">void</span><span class="w"> </span><span class="nf">setup</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Ethernet</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">mac</span><span class="p">);</span><span class="w"></span>

<span class="w">    </span><span class="c1">// your setup logic goes here</span>
<span class="p">}</span><span class="w"></span>

<span class="kt">void</span><span class="w"> </span><span class="nf">loop</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Ethernet</span><span class="p">.</span><span class="n">maintain</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">mqtt</span><span class="p">.</span><span class="n">loop</span><span class="p">();</span><span class="w"></span>

<span class="w">    </span><span class="c1">// your loop logic goes here</span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<p>Please note that this limit cannot be changed at runtime.</p>
</section>
<section id="supported-device-types">
<h2>Supported device types<a class="headerlink" href="#supported-device-types" title="Permalink to this headline">¶</a></h2>
<table class="colwidths-given supported-device-types-table docutils align-default">
<colgroup>
<col style="width: 25%" />
<col style="width: 15%" />
<col style="width: 60%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Device type</p></th>
<th class="head"><p>Supported</p></th>
<th class="head"><p>Documentation</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Binary sensor</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-binary-sensor.html"><span class="doc">HABinarySensor</span></a></p></td>
</tr>
<tr class="row-odd"><td><p>Button</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-button.html"><span class="doc">HAButton</span></a></p></td>
</tr>
<tr class="row-even"><td><p>Camera</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-camera.html"><span class="doc">HACamera</span></a></p></td>
</tr>
<tr class="row-odd"><td><p>Cover</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-cover.html"><span class="doc">HACover</span></a></p></td>
</tr>
<tr class="row-even"><td><p>Device tracker</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-device-tracker.html"><span class="doc">HADeviceTracker</span></a></p></td>
</tr>
<tr class="row-odd"><td><p>Device trigger</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-device-trigger.html"><span class="doc">HADeviceTrigger</span></a></p></td>
</tr>
<tr class="row-even"><td><p>Fan</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-fan.html"><span class="doc">HAFan</span></a></p></td>
</tr>
<tr class="row-odd"><td><p>Humidifier</p></td>
<td><p>❌</p></td>
<td><p>–</p></td>
</tr>
<tr class="row-even"><td><p>HVAC</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-hvac.html"><span class="doc">HAHVAC</span></a></p></td>
</tr>
<tr class="row-odd"><td><p>Light</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-light.html"><span class="doc">HALight</span></a></p></td>
</tr>
<tr class="row-even"><td><p>Lock</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-lock.html"><span class="doc">HALock</span></a></p></td>
</tr>
<tr class="row-odd"><td><p>Number</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-number.html"><span class="doc">HANumber</span></a></p></td>
</tr>
<tr class="row-even"><td><p>Scene</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-scene.html"><span class="doc">HAScene</span></a></p></td>
</tr>
<tr class="row-odd"><td><p>Select</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-select.html"><span class="doc">HASelect</span></a></p></td>
</tr>
<tr class="row-even"><td><div class="line-block">
<div class="line">Sensor (text)</div>
</div>
</td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-sensor.html"><span class="doc">HASensor</span></a></p></td>
</tr>
<tr class="row-odd"><td><div class="line-block">
<div class="line">Sensor (number)</div>
</div>
</td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-sensor-number.html"><span class="doc">HASensorNumber</span></a></p></td>
</tr>
<tr class="row-even"><td><p>Switch</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-switch.html"><span class="doc">HASwitch</span></a></p></td>
</tr>
<tr class="row-odd"><td><p>Tag scanner</p></td>
<td><p>✅</p></td>
<td><p><a class="reference internal" href="../api/device-types/ha-tag-scanner.html"><span class="doc">HATagScanner</span></a></p></td>
</tr>
<tr class="row-even"><td><p>Vacuum</p></td>
<td><p>❌</p></td>
<td><p>–</p></td>
</tr>
</tbody>
</table>
</section>
</section>


          </div>
          <div class="page-nav">
            <div class="inner"><ul class="page-nav">
  <li class="prev">
    <a href="discovery.html"
       title="previous chapter">← Discovery</a>
  </li>
  <li class="next">
    <a href="mqtt-security.html"
       title="next chapter">MQTT security →</a>
  </li>
</ul><div class="footer" role="contentinfo">
      &#169; Copyright 2022, Dawid Chyrzynski.
    <br>
    Created using <a href="http://sphinx-doc.org/">Sphinx</a> 4.5.0 with <a href="https://github.com/schettino72/sphinx_press_theme">Press Theme</a> 0.8.0.
</div>
            </div>
          </div>
      </page>
    </div></div>
    
    
  </body>
</html>